import threading
import time

# 自定义线程类
class MyThread(threading.Thread):
    def __init__(self, name, delay):
        threading.Thread.__init__(self)
        self.name = name
        self.delay = delay

    def run(self):
        count = 0
        while count < 5:
            time.sleep(self.delay)
            count += 1
            print(f'Thread {self.name}: {time.ctime(time.time())}')

# 创建线程实例并启动
thread1 = MyThread('1', 1)
thread2 = MyThread('2', 2)
thread1.start()
thread2.start()

# 等待线程结束
thread1.join()
thread2.join()

print('Multithreading with custom thread class is over')
